package com.java110.mall.goods.bmo.housekeepingResource.impl;


import com.java110.core.annotation.Java110Transactional;
import com.java110.mall.goods.bmo.housekeepingResource.IDeleteHousekeepingResourceBMO;
import com.java110.intf.cart.IHousekeepingFeeConfigInnerServiceSMO;
import com.java110.intf.cart.IHousekeepingResourceFeeInnerServiceSMO;
import com.java110.intf.goods.IHousekeepingResourceInnerServiceSMO;
import com.java110.po.housekeeping.HousekeepingFeeConfigPo;
import com.java110.po.housekeeping.HousekeepingResourcePo;
import com.java110.po.housekeeping.HousekeepingResourceFeePo;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service("deleteHousekeepingResourceBMOImpl")
public class DeleteHousekeepingResourceBMOImpl implements IDeleteHousekeepingResourceBMO {

    @Autowired
    private IHousekeepingResourceInnerServiceSMO housekeepingResourceInnerServiceSMOImpl;
    @Autowired
    private IHousekeepingFeeConfigInnerServiceSMO housekeepingFeeConfigInnerServiceSMOImpl;
    @Autowired
    private IHousekeepingResourceFeeInnerServiceSMO housekeepingResourceFeeInnerServiceSMOImpl;
    /**
     * @param housekeepingResourcePo 数据
     * @return 订单服务能够接受的报文
     */
    @Java110Transactional
    public ResponseEntity<String> delete(HousekeepingResourcePo housekeepingResourcePo, HousekeepingFeeConfigPo housekeepingFeeConfigPo, HousekeepingResourceFeePo housekeepingResourceFeePo) {

        int flag = housekeepingResourceInnerServiceSMOImpl.deleteHousekeepingResource(housekeepingResourcePo);

        if (flag < 1) {
        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "删除失败");
        }
        int rflag = housekeepingResourceFeeInnerServiceSMOImpl.deleteHousekeepingResourceFee(housekeepingResourceFeePo);

        if (rflag < 1) {
            return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "删除失败");
        }
        int cflag = housekeepingFeeConfigInnerServiceSMOImpl.deleteHousekeepingFeeConfig(housekeepingFeeConfigPo);

        if (cflag < 1) {
            return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "删除失败");
        }

        return ResultVo.createResponseEntity(ResultVo.CODE_OK, "删除成功");
    }

}
